Skip to content

Conversation

wingo
Copy link
Contributor

@wingo wingo commented Mar 1, 2018

This PR marks a checkpoint for this branch which ports the TCP implementation from https://github.com/m-labs/smoltcp.

The protocol library, the ring buffer module, and the reorder buffer are in good shape. The timer module is in good shape but might need to be refactored to work with the timer wheel from #1292. Then the core of TCP, lib.tcp.socket, is only half-ported at this point. I realized that I wasn't sure how I was going to drive the library so I implemented fibers (#1292) and an example app in apps.tcp.server.

From the notes in socket.lua:

-- I started this port of smoltcp thinking that I would want a big flat
-- ctable.  However in the end I don't think that's the right thing,
-- because the sockets can move around in memory, and if you implement a
-- TCP service, you'd like to be able for the fiber or whatever that
-- serves a connection to be able to work with the socket directly --
-- but if it can move around in memory, you're inviting problems.
--
-- So, the next step here is to refactor this to make the "socket" the
-- primary object and not the socket table.  At the same time, the
-- "proto" library changed since this code was first written; need to
-- port there.  But in general I would say (to myself, probably!), look
-- at apps/tcp/server.lua and figure out what needs to be done here to
-- make that work.

Following smoltcp's example, the actual data is written directly in the
ring buffer; the reorder buffer just holds bookkeeping data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant